package models

import (
	"time"
	"vip_video/internal"
)

type VideoModel struct {
	Id           int64      `json:"id" db:"id"`
	Title        string     `json:"title" db:"title"`
	Thumb        string     `json:"thumb" db:"thumb"`
	CategoryId   int64      `json:"category_id" db:"category_id"`
	Intro        *string    `json:"intro" db:"intro"`
	Year         *string    `json:"year" db:"year"`
	Duration     *string    `json:"duration" db:"duration"`
	Desc         string     `json:"desc" db:"desc"`
	ViewNum      int64      `json:"view_num" db:"view_num"`
	Creator      string     `json:"creator" db:"creator"`
	CreatedAt    time.Time  `json:"created_at" db:"created_at"`
	Updater      *string    `json:"updater" db:"updater"`
	UpdatedAt    *time.Time `json:"updated_at" db:"updated_at"`
	CategoryName *string    `json:"category_name" db:"category_name"`
}

func (vm *VideoModel) GetFullThumbAttr() *VideoModel {
	vm.Thumb = internal.ParseStaticUrl(vm.Thumb)
	return vm
}
